Repository navigation
A comment written on a ticket while a run works is kept, acknowledged and acted on - #664
Merged
Merged
Conversation
… and acted on A run asked three questions on its ticket, proposed defaults and kept building. A person answered on the ticket twenty minutes later. The gateway logged that a run was in progress and dropped the comment: nothing acknowledged it, the run never saw it, and its notes kept saying it went on without the answers. Comments written before any run existed were dropped too, and nothing read them when the run started. Every ticket source now goes through one path (common::ticket_comments): - The gateway keeps the comment once per comment id (a webhook delivered twice is one comment), acknowledges it on the ticket the first time it is seen while a run works (a reaction on GitHub, one short reply in Jira; never for CoderHelm's own comments or other bots), notes it on the run page and tells the worker at once. - The run reads its open comments together when it starts and at its plan, implement, test and pull request boundaries. Answers and instructions go into the plan while it is being made. Once the plan is final they become one feedback round on the pull request when the step ends: the code changes where the plan put the choice, the pull request says what changed, and the ticket is told. A comment that says to stop ends the run at once. - Each comment is claimed in one conditional write before anything is done with it, so it is acted on once. One nobody read stays open for what comes next: the next step, a round on the finished run's pull request, the ticket started again (a run that ended waiting or failed), or the next run on the ticket (a run a person stopped). - Comments written before the run started are read at its first boundary: a Jira ticket's come with its event from the Jira app, a GitHub issue's are read by the run. They are context and never stop the run. Incident case aq_comment_during_run.
A comment written while no run works was stored for every ticket in a connected Jira project, for 30 days. It is now stored only when the ticket carries the team's trigger label or is assigned to CoderHelm when the comment is written (the rule that starts a run). Comments on every other ticket are never stored: when a run starts there, the event that starts it brings the ticket's comments, and a GitHub run reads the issue's. Records expire after 14 days for a comment written while a run worked and 7 days for one written before a run. Nothing reads a comment after it is acted on; the record only guards against a repeated delivery and keeps a comment nobody read for what comes next. A Jira app older than the version that sends comments with the ticket leaves CoderHelm no way to read them: the gateway notes on the ticket's record whether the event carried comments, and the run says on its page when comments written before it started were not read. The Jira app sends at most 200,000 characters of comment bodies with an event, leaving out the oldest whole. Its manifest is unchanged: no new scope or permission.
…ok too A run started by a plain Jira webhook (no app) was told that the site's Jira app is a version that does not send comments. No app is involved on that path. The ticket's record now keeps how the event arrived, and the run's note says what is true for each: an older Jira app does not send the ticket's comments and updating it does; a Jira webhook sends none with a ticket. CoderHelm cannot read them another way on either path: the webhook path holds an address and a signing secret, nothing that reads the Jira site.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A run asked three questions on its ticket ("Questions only a person can answer"), proposed defaults and kept building. A person answered on the ticket twenty minutes later. The gateway logged
Ignoring Jira comment — run already in progressand returned: nothing acknowledged the comment, the run never saw it, and its notes kept saying it went on without the answers. Comments written before any run existed were dropped asNo runs found for Jira comment — ignoring, and nothing read them when the run started.Root cause:
handle_jira_commentinservices/gateway/src/routes/jira_webhook.rsreturned early for a run inrunning,queuedorawaiting_ciand kept nothing, and no step of the run ever read the ticket again. The same drop existed for GitHub issues (a comment on an issue with a run in flight that did not mention CoderHelm, andSkipping slash command — run already in flight).A person who writes on a ticket CoderHelm is working on now gets an acknowledgement, and what they wrote is acted on, through one path for every ticket source.
Changes
One shared path:
common::ticket_comments(new)TICKETCOMMENT#<ticket>#<source>-<id>, conditional put), so a webhook delivered twice is one comment. Items expire through the table'sttl: 14 days for a comment written while a run worked, 7 days for one written before a run. Nothing reads a comment after it is acted on; the record only guards against the same comment being delivered again, and keeps one nobody read (a worker that stopped, a round that could not be sent) for what comes next. A run and its wait for CI end within 26 hours and the rounds on its pull request follow within days, so two weeks covers them.stores_before_run: a comment written while no run works is stored only for a ticket CoderHelm has something to do with (the team's trigger label, or assigned to CoderHelm, when the comment is written). Comments on every other ticket are never stored.is_person: CoderHelm's own comments and other bots are never taken (account typeBot/app, a[bot]login, CoderHelm's name in Jira, or text that is CoderHelm's own acknowledgement).ack_for: one acknowledgement per comment, only for a person, only the first time it is seen, only while a run works. A reaction on GitHub, one short reply in Jira.Class(answer, instruction, stop, not for CoderHelm),Stage(planning, building, reviewing, between steps, finished, cancelled) anddecide: what happens with each class at each stage.settle_open: each comment is claimed in one conditional write before anything is done with it, so two readers never act on it twice. A burst is read together in one model call.Gateway
routes/ticket_comments.rs(new):receivekeeps the comment, acknowledges it, adds a note to the run page, and sends the worker a message so it is read at once.keepkeeps a comment written before a run, for a ticket that is CoderHelm's to work.on_github_issue_commenttakes a comment on an issue whose run is working (only from a person with standing, as for any comment that starts work).jira_webhook.rs: a comment for a run in progress goes toreceiveinstead of being dropped; a comment on a ticket without a run is kept only when the ticket carries the trigger label or is assigned to CoderHelm (ticket_triggers, the same rule that starts a run), and is otherwise not stored; the comments the Jira app sends with the event that starts a run are kept then, which is how a run reads a ticket whose comments were never stored. The ticket's record notes whether that event carried comments at all.github_webhook.rs(two small insertions): an issue comment that does not mention CoderHelm, and a mention or slash command while a run is in flight, go to the run instead of being dropped.Worker
passes/ticket_comments.rs(new):at_boundary(the run's own step),after_step(a step ended),after_round(a round on the pull request ended),on_comment(a comment just arrived).passes/mod.rs: the run reads its ticket's open comments when it starts and at the plan, implement, test and pull request boundaries, andorchestrate_ticketreads them once more when the step ends.report_questionskeeps the run's questions on the run record so an answer is matched to its question; the note that said the run "goes on without the answers" now says it applies an answer when one arrives.main.rs: a feedback or resume round reads the ticket's open comments when it ends.jira_comment.rs: the comment reader handles open comments first;record_notesis shared.Jira app (
coderhelm-jira)src/comments.js, at most 200,000 characters of bodies in all, oldest left out whole), and a comment event carries the author's account type. Merging this publishes the app through the existing release workflow.manifest.ymlis unchanged, and the ticket'scommentfield is read withread:jira-work, which the app already has, so no site admin has to approve the update.commentsoraccountType.commentswith the event. CoderHelm has no other way to read a Jira ticket's comments (the app's web triggers return none), so the run says on its page that comments written before it started were not read (note_unread_earlier).event_comments_marker).Run page
Shared files touched:
gateway/src/routes/github_webhook.rs(+17 −1),worker/src/main.rs(+8 −2),gateway/src/routes/mod.rs(+1),common/src/lib.rs(+2),worker/src/passes/incidents/mod.rs(+1),docs/incidents.md(+1 row, caseaq).Verification
cargo fmt --check --all,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace: all pass locally.node --testincoderhelm-jira: passes.a_comment_is_kept_once_whatever_the_webhook_delivers,the_key_is_the_comment_id_and_a_missing_id_is_still_one_key,a_comment_during_a_run_is_kept_and_acknowledged_onceone_acknowledgement_per_comment_and_none_for_bots,only_a_persons_comment_counts,coderhelms_own_comments_and_bots_are_never_taken,github_gets_a_reaction_and_every_working_status_countseach_class_at_each_stage,the_stage_comes_from_the_run_record,while_planning_answers_and_instructions_go_into_the_plan,while_building_or_reviewing_they_wait_for_the_pull_request,between_steps_they_stay_for_the_next_step,a_finished_run_gets_a_round_and_a_waiting_one_starts_again,a_cancelled_run_keeps_them_on_the_ticket_for_the_next_runa_stop_is_honoured_at_once_while_the_run_works,a_stop_settles_only_itself_and_the_rest_stay_for_the_next_run,a_stop_ends_the_run_and_is_said_on_the_ticketa_burst_is_read_together_and_each_comment_is_acted_on_oncethe_tickets_existing_comments_are_read_from_the_event,an_issues_existing_comments_are_context_for_the_run_that_starts,a_ticket_whose_comments_were_never_stored_gets_them_from_the_event_that_starts_the_run,an_event_from_an_older_jira_app_is_told_apart_from_a_ticket_without_comments,a_run_started_by_an_older_jira_app_says_earlier_comments_were_not_read,a_run_started_by_a_plain_jira_webhook_says_so_without_blaming_an_app,nothing_is_said_when_the_comments_came_or_nothing_is_known,an_older_jira_app_and_a_plain_webhook_get_their_own_note,comments.test.jsa_comment_on_a_ticket_coderhelm_has_nothing_to_do_with_is_never_stored,a_ticket_is_coderhelms_by_its_label_or_its_assignee,a_comment_before_a_run_is_stored_only_for_a_ticket_coderhelm_works,records_are_kept_two_weeks_and_a_week_before_a_runthe_pipeline_reads_comments_at_its_boundaries_and_when_a_step_ends,the_webhooks_no_longer_drop_a_comment_for_a_run_in_progressaq_comment_during_run(four tests), listed indocs/incidents.md.Known limits: